<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/11/20
 * Time: 13:19
 */

namespace App\Http\Controllers\Api;

use App\Helpers\Api\ApiResponse;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class DataController extends ApiController
{
    /**
     * @apiPermission none
     * @apiPermission anyone
     * @apiGroup Data
     * @api {get} /api/v1/getData 1.查看redis数据
     * @apiName getData
     * @apiVersion 1.0.0
     * @apiDescription app 1.查看redis数据
     * @apiParam {int} int 随意数字
     * @apiSuccess {json} Success-Response:
     * { "result": "测试" ,"status_code":0}
     * @apiSampleRequest /api/v1/getData
     */
    public function getData(Request $request){
        $int =$request->get("int");
        $redis =app("redis");
        $keys =$redis->keys("device:list:*");
        $data =[];
        if($keys){
            foreach ($keys as $key){
                $word='状态为'.str_replace(':',"",substr($key,12,4)).'的个数:'.$redis->llen($key);
//                $data[$key] =$redis->llen($key);
                var_dump($word);
            }
        }
//        var_dump($data);

    }

    /**
     * @apiPermission none
     * @apiPermission anyone
     * @apiGroup Data
     * @api {get} /api/v1/getAcData 1.查看redis数据(账号)
     * @apiName getAcData
     * @apiVersion 1.0.0
     * @apiDescription app 1.查看redis数据(账号)
     * @apiParam {int} int 随意数字
     * @apiSuccess {json} Success-Response:
     * { "result": "测试" ,"status_code":0}
     * @apiSampleRequest /api/v1/getAcData
     */
    public function getAcData(Request $request){
        $int =$request->get("int");
        $redis =app("redis");

        $keys =$redis->keys("account:list:*");
//        $data =[];
        if($keys){
            foreach ($keys as $key){
                $word='状态为'.str_replace(':',"",substr($key,13,2)).'的个数:'.$redis->llen($key);
//                $data[$key] =$redis->llen($key);
                var_dump($word);
            }
//            var_dump($data);
        }


    }



}